{% extends '::base.html.twig' %}

{% block body %}
    <h1>{% trans %}global.forum{% endtrans %}</h1>
    <h2>{{ forum.name }}</h2>
    
    {% if app.user != null %}
        <a href="{{ path('MeestersForumBundle_TopicNew', {'forumId': forum.id}) }}">{% trans %}forum.display.button.new_topic{% endtrans %}</a>
    {% endif %}
        
    <table>
        <thead>
            <tr>
                <th colspan="2">{% trans %}forum.display.field.topics{% endtrans %}</th>
                <th>{% trans %}forum.display.field.replies{% endtrans %}</th>
                <th>{% trans %}forum.display.field.views{% endtrans %}</th>
                <th>{% trans %}forum.display.field.last_post{% endtrans %}</th>
            </tr>
        </thead>
        <tbody>
            {% if forum.topics|length > 0 %}
                {% for topic in forum.topics %}
                    <tr>
                        <td>X</td>
                        <td><a href="{{ path('MeestersForumBundle_TopicShow', {'id': topic.id}) }}">{{ topic.name }}</a></td>
                        <td>{{ topic.replyCount }}</td>
                        <td>{{ topic.viewCount }}</td>
                        <td></td>
                    </tr>
                {% endfor %}
            {% else %}
                <tr>
                    <td colspan="5">
                        <p>{% trans %}forum.display.error.empty{% endtrans %}</p>
                    </td>
                </tr>
            {% endif %}
        </tbody>
    </table>
{% endblock %}